package model.workerWithFile;

import java.util.ArrayList;

import entities.IGarage;
import entities.IMaster;
import entities.IOrder;
import model.textFileWorkerWrapper.TextFileWorkerWrapper;

public class WorkerWithFile {
	
	private TextFileWorkerWrapper orderFile;
	private TextFileWorkerWrapper garageFile;
	private TextFileWorkerWrapper masterFile;

	private ReaderFromFile rff = new ReaderFromFile();

	public WorkerWithFile(String masPath, String ordPath, String garPath) {
		masterFile = new TextFileWorkerWrapper(masPath);
		orderFile = new TextFileWorkerWrapper(ordPath);
		garageFile = new TextFileWorkerWrapper(garPath);
	}

	public void saveGarageList(ArrayList<IGarage> garageList) {
		WriterInFile.saveGarageList(garageList, garageFile);
	}

	public void saveMasterList(ArrayList<IMaster> masterList) {
		WriterInFile.saveMasterList(masterList, masterFile);
	}

	public void saveOrderList(ArrayList<IOrder> orderList) {
		WriterInFile.saveOrderList(orderList, orderFile);
	}

	public ArrayList<IMaster> getListMastersFromFile() {
		return rff.getListMastersFromFile(masterFile);
	}

	public ArrayList<IGarage> getListGaragesFromFile() {
		return rff.getListGaragesFromFile(garageFile);
	}

	public ArrayList<IOrder> getOrderFromFile() {
		return rff.getOrderFromFile(orderFile);
	}

}
